home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11472 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  58 lines

  1. Newsgroups: comp.lang.c
  2. Path: newshub.nosc.mil!news!news
  3. From: anuzen@nosc.mil
  4. Subject: BIOSCOM DOS Serial Port Comm with Turbo C version 3.0
  5. Content-Type: TEXT/PLAIN; charset=US-ASCII
  6. Message-ID: <NEWTNews.827645153.20850.anuzen@mork.nosc.mil>
  7. Sender: news@nosc.mil
  8. Organization: NCCOSC RDT&E Division, San Diego, CA
  9. X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage
  10. Mime-Version: 1.0
  11. Date: Sun, 24 Mar 1996 04:20:53 GMT
  12.  
  13.  
  14. I've been using the sample bioscom program with my DOS turboc 2.0 for a long 
  15. time, but now I can't seem to make it work right on my Turboc 3.0 Dos 6.2 486 
  16. machine. The program seems to slow down after receiving a few bytes from the 
  17. com port. Can someone help? also, are there sample serial port communication 
  18. sources somewhere that I can use with my DOS Turbo C version 3.0?
  19.  
  20. Thanks,
  21.  
  22. Ahn.
  23. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24.  
  25. #include <bios.h>
  26. #include <conio.h>
  27.  
  28. #define COM1       0
  29. #define DATA_READY 0x100
  30. #define TRUE       1
  31. #define FALSE      0
  32.  
  33. #define SETTINGS ( 0xE0 | 0x00 | 0x03 | 0x00)
  34.  
  35. int main(void)
  36. {
  37.    int in, out, status, DONE = FALSE;
  38.  
  39.    bioscom(0, SETTINGS, COM1);
  40.    cprintf("... BIOSCOM [ESC] to exit ...\n");
  41.    while (!DONE)
  42.    {
  43.       status = bioscom(3, 0, COM1);
  44.       if (status & DATA_READY)
  45.      if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)
  46.         putch(out);
  47.      if (kbhit())
  48.      {
  49.         if ((in = getch()) == '\x1B')
  50.            DONE = TRUE;
  51.         bioscom(1, in, COM1);
  52.      }
  53.    }
  54.    return 0;
  55. }
  56.  
  57.  
  58.